// 写分类页面发送的请求
import request from "../untils/request";
// 页面分类信息 
export const FindeClassify = () => {
	return request("/api/front/category")
}

// 商品列表
export const Finddetail = (cid, keyword, page, limit, news, priceOrder, salesOrder) => {
	console.log(cid, "aaaaaa");
	return request("/api/front/products", {
		cid: cid,
		keyword: keyword,
		page: page,
		limit: limit,
		news: news,
		priceOrder: priceOrder,
		salesOrder: salesOrder
	})
}
//商品详情
export const ProductDetails = (id) => {
	console.log(id);
	const url = "/api/front/product/detail/" + id
	return request(url)
}
// 商品评论
export const Findcomments = (id) => {
	const url = "/api/front/reply/config/" + id
	return request(url)
}
// 商品评论列表
export const FindList = (id, type) => {
	const url = "/api/front/reply/list/" + id + '?page=1&limit=20&type=' + type
	return request(url)
}
// 优品推荐
export const Findremmed = () => {
	return request("/api/front/product/good")
}

// 购物车新增
export const AddShoop = (cartNum, isNew, productAttrUnique, productId) => {
	return request("/api/front/cart/save", {
		cartNum: cartNum,
		isNew: isNew,
		productAttrUnique: productAttrUnique,
		productId: productId,
	}, "post")
}

//购物车数量
export const FindNum = (numType, type) => {
	return request("/api/front/cart/count", {
		numType: numType,
		type: type
	})
}
// 收藏添加
export const Addcollection = (category, id) => {
	return request("/api/front/collect/add", {
		category,
		id
	}, "post")
}
// 取消收藏
export const RemoveColl = (proId) => {
	const url = "/api/front/collect/cancel/" + proId
	return request(url, "", "post")
}
